local CollectLogic = require("collect.CollectLogic")
local Msg = require("core.Msg")
local Obj = require("core.Obj")

function CG_COLLECT_START(human, msg)
	if human.db.hp < 1 then
		return
	end
	local msgRet = Msg.gc.GC_COLLECT_START
	msgRet.objID = msg.objID
	msgRet.retCode, msgRet.tip, msgRet.sec = CollectLogic.collectStart(human, msg.objID)
	msgRet.tip = msgRet.tip or ""
	msgRet.sec = msgRet.sec or 0
	if 0 < msgRet.sec then
		local collect = Obj.objs[msg.objID]
		local mm = Msg.gc.GC_COLLECT_START_FOR_OTHER
		mm.sec = msgRet.sec
		mm.obj_id = human.id
		if collect.dropMonsterID then
			mm.is_jinghun = 1
		else
			mm.is_jinghun = 0
		end
		Obj.sendArea(mm, human.scene_id, human.x, human.y)
	end
	Msg.send(msgRet, human.fd)
end

function CG_COLLECT_FINISH(human, msg)
	CollectLogic.collectFinish(human, msg.objID)
end

function CG_COLLECT_CAN_QUERY(human, msg)
	CollectLogic.canQuery(human, msg.objID)
end